#include <map>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
class Solution {
public:
    vector<string> uncommonFromSentences(string s1, string s2) {
        vector<string> vstr;
        map<string, int> m;
        int begin = 0;
        int end = 0;
        for (size_t i = 0; i <= s1.size(); ++i, end++)
        {
            if (s1[i] == ' '||i==s1.size())
            {
                m[string(&s1[begin], &s1[end])]++;
                begin = end + 1;
            }

        }
        begin = end = 0;
        for (size_t i = 0; i <= s2.size(); ++i, end++)
        {
            if (s2[i] == ' '|| i==s2.size())
            {
                m[string(&s2[begin], &s2[end])]++;
                begin = end + 1;
            }

        }
        for (auto& e : m)
        {
            if (e.second == 1)
            {
                vstr.push_back(e.first);
            }
        }
        return vstr;
    }
};
int main()
{
    string s1 = "this apple is sweet";
    string s2 = "this apple is sour";
    Solution s;
    s.uncommonFromSentences(s1,s2);
    return 0;
}